package com.bf.electroplating.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bf.electroplating.pojo.dto.IdDTO;
import com.bf.electroplating.pojo.dto.renovate.ControlProblemRenovateQueryDTO;
import com.bf.electroplating.pojo.dto.renovate.ControlRenovateRectificationDTO;
import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.renovate.ControlProblemRenovateVO;
import com.bf.electroplating.pojo.vo.renovate.ControlRenovateRectificationVO;
import com.bf.electroplating.service.ControlRenovateRectificationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;

/**
 * 整改问题整改管理
 *
 * @author 15451
 */
@Tag(name = "整改问题整改管理")
@RestController
@RequestMapping("/control/renovate/rectification")
public class ControlRenovateRectificationController {

    @Resource
    private ControlRenovateRectificationService rectificationService;

    @Operation(summary = "整改问题分页列表")
    @PostMapping("/page")
    public ResultVO<Page<ControlProblemRenovateVO>> page(@RequestBody ControlProblemRenovateQueryDTO dto) {
        return ResultVO.ok(rectificationService.pageList(dto));
    }

    @Operation(summary = "整改问题详情")
    @PostMapping("/detail")
    public ResultVO<ControlRenovateRectificationVO> detail(@RequestBody IdDTO id) {
        return ResultVO.ok(rectificationService.detail(id.getId()));
    }

    @Operation(summary = "整改问题整改")
    @PostMapping("/rectification")
    public ResultVO<String> rectification(@RequestBody ControlRenovateRectificationDTO dto) {
        rectificationService.rectification(dto);
        return ResultVO.ok(null,"编辑成功");
    }
}